export const addConsultationServer = (editor) => {
    /*
      咨询服务单元卡片组件
    */
      const consultationServer = (editor) => {
        const { Components } = editor;
        Components.addType('consultationServer', {
          model: {
            defaults: {
              name: 'consultationServer',
              droppable: false,
              components: [
                {
                  type: 'div',
                  attributes: { style:'width: 700px;' , class:'consultationServer' },
                  components: [
                    {
                      type: 'text',
                      attributes: {
                        style:'width: 100%;font-size: small;font-weight: 100;color:black'
                      },
                      content:'计算机分析'
                    },
                    {
                      type: 'div',
                      attributes: { style: 'width:100%;height: 150px;background-color:white;position: relative;display: flex;margin-top: 10px;border: solid lightgray 1px;' },
                      components: [
                        {
                          type: 'image',
                          attributes: { src:'https://cdn4.codesign.qq.com/prototypes/2023/08/03/xDP3923q32qn08ZwlKp03/apgsmrtqzvfi3x3v/916fbb3c05f25537980991ab0d0e74a6.png' },
                        },
                        {
                          type: 'text',
                          attributes: { class:'content' },
                          components: [
                            {
                              type: 'div',
                              attributes: { class:'server-background' },
                            },
                            {
                              type: 'div',
                              attributes: { class:'server-btn' },
                              components: [
                                {
                                  type:'text',
                                  attributes:{
                                    class:'server-btnImp'
                                  },
                                  // content:'设置数据→'
                                  content:'查看详情→'
                                },
                              ]
                            },
                            {
                              type: 'text',
                              attributes: { style:"font-size: medium;font-weight: 330;margin:15px 20px" },
                              content:'BIM技术在医院中的应用'
                            },
                            {
                              type: 'text',
                              attributes: { style:"font-size: small;font-weight: 100;margin: 10px 20px;" },
                              content:'本项目位于深圳市超级总部基地南侧，西接沙河西路立交改造工程，东至广深高速公路，全长约5.95Km。其中总部基地段（沙河东路-深湾五路）为下沉改造段，主线隧道暗埋段长度1.56Km，两侧分别设置268m及235m敞开段；下沉隧道上部改造为上盖绿地休闲空间'
                            },
                          ]
                        }
                      ]
                    },
                  ],
                },
              ],
              script() {
                var that = document.getElementById(this.attributes.id.value);
                // var btnImp = that.getElementsByClassName('server-btnImp')[0];
                // btnImp.onclick = function (){
                //   if(btnImp.innerText === '设置数据→'){
                //     btnImp.innerText = '查看详情→'
                //   }
                // }
              },
              styles: `
              .consultationServer img{
                width: 30%;height: 100%;
              }
              .content{
                width: 70%;height: 100%;
                color:black;
              }
              .server-btn{
                  display: none;width: 70%;height: 100%;position: absolute;align-items: center;justify-content: center;
              }
              .server-btnImp{
                  position: absolute;color: white;background-color: rgb(64, 158, 255);border: 0px;padding: 10px;
              }
              .server-btn button{
                  cursor: pointer;
              }
              .server-background{display: none;background-color: black;filter: opacity(0.7);width: 70%;height: 100%;position: absolute;}
              .content:hover .server-btn{
                  display: flex;
              }
              .content:hover .server-background{
                  display: inherit;
              }
            `,
            },
          },
        });
      };
      consultationServer(editor);
      editor.BlockManager.add("consultationServer", {
        label: "咨询服务",
        category: "产品中心组件",
        select: true,
        content: { type: "consultationServer" },
      });
}